package com.pay.Essearch.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 商品表
 * @TableName t_goods
 */
@TableName(value ="t_goods")
@Data
@Document(indexName = "goods",shards = 1,replicas = 0)
public class TGoods implements Serializable {
    /**
     * 主键，自增
     */
    @Id
    @TableId(type = IdType.AUTO)
    @Field(type = FieldType.Long)
    private Long goodId;

    /**
     * 商品名称
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String goodName;

    /**
     * 单价（元）
     */
    @Field(type = FieldType.Double)
    private BigDecimal price;

    /**
     * 库存数量
     */
    @Field(type = FieldType.Integer)
    private Integer stock;

    /**
     * 是否上架：1 是 0 否
     */
    @Field(type = FieldType.Integer)
    private Integer onSale;

    /**
     * 创建时间
     */
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新时间
     */
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;


}